package com.tm.d14_method_references;

import java.util.Arrays;
import java.util.Comparator;

/**
 *2024/5/25 Cjj 特定类型的方法引用 18:41
 */
public class Test {
    public static void main(String[] args) {
        String[] names ={"boby","angela","Andy" ,"dlei", "caocao","Babo","jack","Cici"};

        //按照升序排序
        //Arrays.sort(names);
        //System.out.println(Arrays.toString(names));

        //要求忽略首字符大小写进行排序
       /* Arrays.sort(names, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.compareToIgnoreCase(o2);
            }
        });

        System.out.println(Arrays.toString(names));*/


        //Arrays.sort(names, (o1, o2) -> o1.compareToIgnoreCase(o2));

        /**特点类型的引用**/
        Arrays.sort(names,String::compareToIgnoreCase);
        System.out.println(Arrays.toString(names));
    }


}
